| Aaron Colwell | c6841a0 | 2014-03-07 01:37:56 | [diff] [blame] | 1 | <!DOCTYPE html> |
| 2 | <html> |
| 3 | <head> |
| Aaron Colwell | aa3c90b | 2014-08-04 17:58:37 | [diff] [blame] | 4 | <title>Simple MediaSource playback test case.</title> |
| Aaron Colwell | 06f8ec2 | 2014-03-07 18:09:47 | [diff] [blame] | 5 | <script src="/resources/testharness.js"></script> |
| 6 | <script src="/resources/testharnessreport.js"></script> |
| Aaron Colwell | c6841a0 | 2014-03-07 01:37:56 | [diff] [blame] | 7 | <script src="mediasource-util.js"></script> |
| Aaron Colwell | c6841a0 | 2014-03-07 01:37:56 | [diff] [blame] | 8 | </head> |
| 9 | <body> |
| 10 | <div id="log"></div> |
| 11 | <script> |
| 12 | mediasource_testafterdataloaded(function(test, mediaElement, mediaSource, segmentInfo, sourceBuffer, mediaData) |
| 13 | { |
| 14 | test.failOnEvent(mediaElement, 'error'); |
| 15 | test.endOnEvent(mediaElement, 'ended'); |
| 16 | |
| Aaron Colwell | cffb8af | 2014-05-23 22:27:10 | [diff] [blame] | 17 | test.expectEvent(sourceBuffer, 'updatestart', 'sourceBuffer'); |
| 18 | test.expectEvent(sourceBuffer, 'update', 'sourceBuffer'); |
| 19 | test.expectEvent(sourceBuffer, 'updateend', 'sourceBuffer'); |
| Aaron Colwell | c6841a0 | 2014-03-07 01:37:56 | [diff] [blame] | 20 | |
| 21 | sourceBuffer.appendBuffer(mediaData); |
| Aaron Colwell | cffb8af | 2014-05-23 22:27:10 | [diff] [blame] | 22 | |
| 23 | test.waitForExpectedEvents(function() |
| 24 | { |
| 25 | assert_false(sourceBuffer.updating, "updating"); |
| 26 | assert_greater_than(mediaSource.duration, 1, "duration"); |
| 27 | |
| 28 | mediaSource.duration = 1; |
| 29 | |
| 30 | assert_true(sourceBuffer.updating, "updating"); |
| 31 | test.expectEvent(sourceBuffer, 'updatestart', 'sourceBuffer'); |
| 32 | test.expectEvent(sourceBuffer, 'update', 'sourceBuffer'); |
| 33 | test.expectEvent(sourceBuffer, 'updateend', 'sourceBuffer'); |
| 34 | }); |
| 35 | |
| 36 | test.waitForExpectedEvents(function() |
| 37 | { |
| 38 | mediaSource.endOfStream(); |
| 39 | mediaElement.play(); |
| 40 | }); |
| James Graham | 1da6470 | 2015-05-01 12:22:22 | [diff] [blame] | 41 | }, "Test normal playback case with MediaSource API"); |
| Aaron Colwell | c6841a0 | 2014-03-07 01:37:56 | [diff] [blame] | 42 | </script> |
| 43 | </body> |
| 44 | </html> |